person = input()
payments = float(input())
if person == 's':
    if 0 < payments < 5000:
        revenues = 0
    elif 5000 < payments < 12000:
        revenues = 0 + (payments-5000)*0.15
    elif 12000 < payments < 125000:
        revenues = 0 + 7000*0.15 + (payments-12000)*0.25
    elif payments > 125000:
        revenues = 0 + 7000*0.15 + 113000*0.25 + (payments-125000)*0.35
elif person == 'm':
    if 0 < payments < 10000:
        revenues = 0
    elif 10000 < payments < 24000:
        revenues = 0 + (payments-10000)*0.15
    elif 24000 < payments < 250000:
        revenues = 0 + 14000*0.15 + (payments-24000)*0.25
    elif payments > 250000:
        revenues = 0 + 7000*0.15 + 226000*0.25 + (payments-250000)*0.35
print(f'{revenues:.2f}')